package com.systemic.utils;

import org.apache.commons.math3.stat.correlation.PearsonsCorrelation;
import org.apache.commons.math3.stat.descriptive.moment.Mean;
import org.apache.commons.math3.stat.descriptive.moment.StandardDeviation;
import org.apache.commons.math3.stat.descriptive.moment.Variance;

/**
 * @ClassName: MathUtils
 * @Description: 计算工具类
 * @Author:
 * @CreateTime: 2024-01-12 13:56
 * @Version:
 **/
public class MathUtils {


    /**
     * 皮尔逊相关系数
     * @param x
     * @param y
     * @return
     */
    public static double Pearson(double[] x, double[] y) {
        Mean meanX = new Mean();
        Mean meanY = new Mean();
        StandardDeviation stdDevX = new StandardDeviation();
        StandardDeviation stdDevY = new StandardDeviation();
        Variance varianceX = new Variance();
        Variance varianceY = new Variance();
        PearsonsCorrelation correlation = new PearsonsCorrelation();
        return correlation.correlation(x, y);
    }




}
